<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="com.library.dao.Librarian" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cho mượn sách</title>
<%
Librarian user=(Librarian)session.getAttribute("instantUser");
%>

<script>
function validateForm()
{
	var userid = document.forms["form1"]["userid"].value;
	var bookid = document.forms["form1"]["bookid"].value;
	var reservationid = document.forms["form1"]["reservationid"].value;
	if (userid == "" || bookid == "" || isNaN(userid) || isNaN(bookid)) {
		alert("Các ô nhập vào đều phải là số");
		return false;
	} else {
		if (reservationid != "") {
			if (isNaN(reservationid)) {
				alert("Các ô nhập vào đều phải là số");
				return false;
			}
		}
	}
	return true;
	
}
</script>

</head>
<body>
<jsp:include page="librarianmenu.jsp" /> 
<br>
<br>
<form id="form1" name="form1" method="post" action="/librarysystem/LendingServlet" onsubmit="return validateForm()">
  <table width="70%" border="0">
  <tr>
      <td width="93" height="31">UserId</td>
      <td width="200"><input name="userid" type="text" id="textfield" size="50"/></td>
    </tr>
    <tr>
      <td width="93" height="31">BookId</td>
      <td width="200"><input name="bookid" type="text" id="textfield" size="50"  /></td>
    </tr>
    <tr>
      <td>ReservationId (optional)</td>
      <td><label>
        <input name="reservationid" type="text" id="textfield2" size="30" />
      </label></td>
    </tr>
    <tr>
      <td><label>
        <input type="submit" value="Lend" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
</body>
</html>